<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGLShader Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGLShader Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1><p>The QGLShader class allows OpenGL shaders to be compiled.
<a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />class <b><a href="qglshader-shadertype.html">ShaderType</a></b></li><li><div class="fn" />enum <b><a href="qglshader.html#ShaderTypeBit-enum">ShaderTypeBit</a></b> { Vertex, Fragment, Geometry }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qglshader.html#QGLShader">__init__</a></b> (<i>self</i>, ShaderType&#160;<i>type</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qglshader.html#QGLShader-2">__init__</a></b> (<i>self</i>, ShaderType&#160;<i>type</i>, QGLContext&#160;<i>context</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qglshader.html#compileSourceCode">compileSourceCode</a></b> (<i>self</i>, QByteArray&#160;<i>source</i>)</li><li><div class="fn" />bool <b><a href="qglshader.html#compileSourceCode-2">compileSourceCode</a></b> (<i>self</i>, QString&#160;<i>source</i>)</li><li><div class="fn" />bool <b><a href="qglshader.html#compileSourceFile">compileSourceFile</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" />bool <b><a href="qglshader.html#isCompiled">isCompiled</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qglshader.html#log">log</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qglshader.html#shaderId">shaderId</a></b> (<i>self</i>)</li><li><div class="fn" />ShaderType <b><a href="qglshader.html#shaderType">shaderType</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qglshader.html#sourceCode">sourceCode</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qglshader.html#hasOpenGLShaders">hasOpenGLShaders</a></b> (ShaderType&#160;<i>type</i>, QGLContext&#160;<i>context</i>&#160;=&#160;None)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGLShader class allows OpenGL shaders to be compiled.</p>
<p>This class supports shaders written in the OpenGL Shading
Language (GLSL) and in the OpenGL/ES Shading Language
(GLSL/ES).</p>
<p>QGLShader and <a href="qglshaderprogram.html">QGLShaderProgram</a> shelter the programmer
from the details of compiling and linking vertex and fragment
shaders.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ShaderTypeBit-enum" />QGLShader.ShaderTypeBit</h3><p>This enum specifies the type of <a href="qglshader.html">QGLShader</a> that is being created.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGLShader.Vertex</tt></td>
<td class="topAlign"><tt>0x0001</tt></td>
<td class="topAlign">Vertex shader written in the OpenGL Shading
Language (GLSL).</td>
</tr>
<tr>
<td class="topAlign"><tt>QGLShader.Fragment</tt></td>
<td class="topAlign"><tt>0x0002</tt></td>
<td class="topAlign">Fragment shader written in the OpenGL Shading
Language (GLSL).</td>
</tr>
<tr>
<td class="topAlign"><tt>QGLShader.Geometry</tt></td>
<td class="topAlign"><tt>0x0004</tt></td>
<td class="topAlign">Geometry shaders written in the OpenGL Shading
Language (GLSL), based on the GL_EXT_geometry_shader4
extension.</td>
</tr>
</table>
<p>The ShaderType type is a typedef for <a href="qflags.html">QFlags</a>&lt;ShaderTypeBit&gt;. It stores an OR
combination of ShaderTypeBit values.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGLShader" />QGLShader.__init__ (<i>self</i>, <a href="qglshader-shadertype.html">ShaderType</a>&#160;<i>type</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="qglshader.html">QGLShader</a> object
of the specified <i>type</i> and attaches it to <i>parent</i>. If
shader programs are not supported, <a href="qglshaderprogram.html#hasOpenGLShaderPrograms">QGLShaderProgram.hasOpenGLShaderPrograms</a>()
will return false.</p>
<p>This constructor is normally followed by a call to <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() or
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>
<p>The shader will be associated with the current <a href="qglcontext.html">QGLContext</a>.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() and
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="QGLShader-2" />QGLShader.__init__ (<i>self</i>, <a href="qglshader-shadertype.html">ShaderType</a>&#160;<i>type</i>, <a href="qglcontext.html">QGLContext</a>&#160;<i>context</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="qglshader.html">QGLShader</a> object
of the specified <i>type</i> and attaches it to <i>parent</i>. If
shader programs are not supported, then <a href="qglshaderprogram.html#hasOpenGLShaderPrograms">QGLShaderProgram.hasOpenGLShaderPrograms</a>()
will return false.</p>
<p>This constructor is normally followed by a call to <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() or
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>
<p>The shader will be associated with <i>context</i>.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() and
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="compileSourceCode" />bool QGLShader.compileSourceCode (<i>self</i>, <a href="qbytearray.html">QByteArray</a>&#160;<i>source</i>)</h3><p>Sets the <i>source</i> code for this shader and compiles it.
Returns true if the source was successfully compiled, false
otherwise.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="compileSourceCode-2" />bool QGLShader.compileSourceCode (<i>self</i>, QString&#160;<i>source</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the <i>source</i> code for this shader and compiles it.
Returns true if the source was successfully compiled, false
otherwise.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="compileSourceFile" />bool QGLShader.compileSourceFile (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Sets the source code for this shader to the contents of
<i>fileName</i> and compiles it. Returns true if the file could be
opened and the source compiled, false otherwise.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>().</p>


<h3 class="fn"><a name="hasOpenGLShaders" />bool QGLShader.hasOpenGLShaders (<a href="qglshader-shadertype.html">ShaderType</a>&#160;<i>type</i>, <a href="qglcontext.html">QGLContext</a>&#160;<i>context</i>&#160;=&#160;None)</h3><p>Returns true if shader programs of type <i>type</i> are
supported on this system; false otherwise.</p>
<p>The <i>context</i> is used to resolve the GLSL extensions. If
<i>context</i> is null, then <a href="qglcontext.html#currentContext">QGLContext.currentContext</a>()
is used.</p>
<p>This function was introduced in Qt 4.7.</p>


<h3 class="fn"><a name="isCompiled" />bool QGLShader.isCompiled (<i>self</i>)</h3><p>Returns true if this shader has been compiled; false
otherwise.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() and
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="log" />QString QGLShader.log (<i>self</i>)</h3><p>Returns the errors and warnings that occurred during the last
compile.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>() and
<a href="qglshader.html#compileSourceFile">compileSourceFile</a>().</p>


<h3 class="fn"><a name="shaderId" />int QGLShader.shaderId (<i>self</i>)</h3><p>Returns the OpenGL identifier associated with this shader.</p>
<p><b>See also</b> <a href="qglshaderprogram.html#programId">QGLShaderProgram.programId</a>().</p>


<h3 class="fn"><a name="shaderType" /><a href="qglshader-shadertype.html">ShaderType</a> QGLShader.shaderType (<i>self</i>)</h3><p>Returns the type of this shader.</p>


<h3 class="fn"><a name="sourceCode" /><a href="qbytearray.html">QByteArray</a> QGLShader.sourceCode (<i>self</i>)</h3><p>Returns the source code for this shader.</p>
<p><b>See also</b> <a href="qglshader.html#compileSourceCode">compileSourceCode</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>